package com.jml.distribute.api.impl;
//
//import com.codingapi.txlcn.tc.annotation.LcnTransaction;
//import com.codingapi.txlcn.tc.config.EnableDistributedTransaction;


import com.jml.distribute.api.DistributeService;
import com.jml.distribute.api.impl.entity.DispatchEntity;
import com.jml.distribute.api.impl.mapper.DispatchMapper;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DistributeServiceImpl implements DistributeService {
    @Autowired
    private DispatchMapper dispatchMapper;

    @Override
    @GlobalTransactional
    public String distributeOrder(@RequestParam("orderId") String orderId) {
        // 获取请求事务id
        DispatchEntity dispatchEntity = new DispatchEntity(orderId, 123456L);
        dispatchMapper.insertDistribute(dispatchEntity);
        return "插入数据成功";
    }
}
